package com.example.demo.service.impl;

import com.example.demo.dao.IProductDao;
import com.example.demo.pojo.Product;
import com.example.demo.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Transactional
@Service
public class ProductServiceImpl implements IProductService {

    @Autowired
    private IProductDao IProductDao;

    @Override
    public List<Product> search() {
        PageRequest pageRequest = PageRequest.of(1, 10);
        Page<Product> search = IProductDao.search(pageRequest);
        List<Product> productList = search.getContent();
        return productList;
    }
}
